<%@ taglib uri="http://java.sun.com/jsf/core" prefix="f"%>
<%@ taglib uri="http://java.sun.com/jsf/html" prefix="h"%>
<%@ page isELIgnored="false"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">

<f:view>
    <html xmlns="http://www.w3.org/1999/xhtml">
        <head>
            <title>Post Message</title>
			<link type="text/css" rel="stylesheet" href="/stylesheets/main.css" />
			<script type="text/javascript" src="/javascripts/main.js"></script>
        </head>
        <body>
            <h:form id="post" binding="#{post.form}">
                <fieldset>
                    <legend>Post Message</legend>
                    <p>You can post a message here.</p>
                    <br/>
				    <table>
						<tr><th width="20%"></th><th></th></tr>
						<tr><td>
                    <h:outputLabel for="username" value="Name">
                        <span class="required">*</span>
                    </h:outputLabel>
					</td>
					<td>
                    <h:inputText id="username" required="true"
                        title="Name" value="#{post.greeting.userName}" size="30" maxlength="50" >
						<f:validateLength minimum="3" />
					</h:inputText>
					<h:message for="username" styleClass="error" />
                    </td></tr>
					<tr><td>
                    <h:outputLabel for="useremail" value="Email address" >
                        <span class="required">*</span>
                    </h:outputLabel>
					</td><td>
                    <h:inputText id="useremail" value="#{post.greeting.userEmail}"
                        title="Email address" size="30" maxlength="60" required="true"
                        validator="#{post.validateEmail}" />
                    <h:message for="useremail" styleClass="error" />
                    </td></tr>
					<tr><td>
                    <h:outputLabel for="message" value="Message">
                        <span class="required">*</span>
                    </h:outputLabel>
					</td><td>
                    <h:inputTextarea id="message"  required="true" value="#{post.greeting.content}"
                        title="Message" rows="4" cols="60">
						<f:validateLength maximum="1000" />
                    </h:inputTextarea>
                    <h:message for="message" styleClass="error" />	
					</td></tr>
					<tr><td></td><td>
                    <h:commandButton value="Register" action="#{post.postGreeting}"
                        styleClass="withoutLabel"  />
                    </td></tr>
					<tr><td></td><td>
                    <p><h:message for="post" infoClass="succes" errorClass="error" /></p>
					</td></tr></table>
                </fieldset>
            </h:form>
            <script type="text/javascript">
                setHighlight('${highlight}');
                //setFocus('${!empty focus ? focus : 'greeting:userName'}');
            </script>
        </body>
    </html>
</f:view>